home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Apps / AudioApps / Resound / SoundManager.m < prev    next >
Text File  |  1992-12-20  |  2KB  |  104 lines

  1.  
  2. #import "SoundManager.h"
  3. #import "Imports.h"
  4.  
  5. @implementation SoundManager
  6.  
  7. - init
  8. {
  9.     CurrentSoundViewUsingDSP=NULL;
  10.     CurrentSoundUsingDSP=NULL;
  11.     Playing=NO;
  12.     Recording=NO;
  13.     return self;
  14. }
  15.  
  16.  
  17. - Stop:sender
  18. {
  19.     if (Playing)
  20.         {
  21.         [CurrentSoundViewUsingDSP stop:self];
  22.         }
  23.     else if (Recording)
  24.         {
  25.         [NewSound stop:self];
  26.         }
  27.     CurrentSoundViewUsingDSP=NULL;
  28.     CurrentSoundUsingDSP=NULL;
  29.     Playing=NO;
  30.     Recording=NO;
  31.     return self;
  32. }
  33.  
  34.  
  35. - Play:sender
  36. {
  37.     CurrentSoundViewUsingDSP=[TheFileController CurrentSoundView:self];
  38.     if (CurrentSoundViewUsingDSP!=NULL) 
  39.         {
  40.         [CurrentSoundViewUsingDSP setDelegate:self];
  41.         [CurrentSoundViewUsingDSP play:self];
  42.         Playing=YES;
  43.         }
  44.     return self;
  45. }
  46.  
  47. - Record: (int) SoundRate: (int) channels: (int) NumberOfSeconds: sender
  48. {
  49.         NewSound=[[Sound alloc] init];
  50.         [NewSound setDelegate:self];
  51.         [TheConsoleManager SetMeterTo: NewSound];
  52.         [NewSound record:self];
  53.         Recording=YES;
  54.         return self;
  55.  
  56. }
  57.  
  58. - CurrentSoundUsingDSP:sender
  59. {
  60.     Recording=YES;
  61.     return self;
  62. }
  63.  
  64. - (BOOL) IsPlaying
  65. {
  66.     return Playing;
  67. }
  68.  
  69. - (BOOL) IsRecording
  70. {
  71.     return Recording;
  72. }
  73.  
  74. - didPlay:sender
  75. {
  76.     [TheConsoleManager TurnOffPlay];
  77.     Playing=NO;
  78.     return self;
  79. }
  80.  
  81. - didRecord:sender
  82. {
  83.     [TheConsoleManager TurnOffRecord];
  84.     [TheFileController NewRecordedSound: NewSound];
  85.     Recording=NO;
  86.     return self;
  87. }
  88.  
  89. - selectionChanged:sender
  90. {
  91.     [TheEditController ChangeSelection:self];
  92.     return self;
  93. }
  94.  
  95. - willPlay:sender
  96. {
  97.     [TheConsoleManager SetMeterTo: [[ TheFileController CurrentSoundView:self ] 
  98.                 soundBeingProcessed]];
  99.     return self;
  100. }
  101.  
  102.  
  103. @end
  104.